#ifndef __OTA_WARE_H__
#define __OTA_WARE_H__


#ifdef __cplusplus
extern "C" {
#endif

/**
 * @brief           A single command in the list of the supported firmware.
 */
typedef struct {
    unsigned int type;          /**< Type of firmware. */
    unsigned int size;          /**< Max size of firmware. */
    unsigned int save;          /**< Save to FLASH or SDRAM */
    unsigned int addr;          /**< Start address of FLASH */
    ota_check_t check;          /**< The check function. */
    ota_update_t update;        /**< The update function. */
} ota_firmware_xfa_t;

#define OTA_WATE_SECTION_NAME "__section_ota_ware_"

#pragma section=OTA_WATE_SECTION_NAME
#define ota_ware_start __section_begin(OTA_WATE_SECTION_NAME)
#define ota_ware_end __section_end(OTA_WATE_SECTION_NAME)

#define __ota_ware_reg(type,size,save,addr,check,update)		\
__root static const ota_firmware_xfa_t __ota_##check##update\
		@ OTA_WATE_SECTION_NAME = \
		{type,size,save,addr,check,update}

#define OTA_WARE_REGISTER(type,size,save,addr,check,update)\
		 __ota_ware_reg(type,size,save,addr,check,update)

#ifdef __cplusplus
}
#endif

#endif